package com.test.demo.repository.impl;

import com.test.demo.entity.Demo;
import com.test.demo.repository.DemoRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

/**
 * demo dao impl
 *
 * @author wzl
 * @date 2022/4/21
 */
@Slf4j
@Repository
public class DemoRepositoryImpl implements DemoRepository {
    @Override
    public Demo findById(Long id) {

        log.info("select sql 输出....");
        Demo demo = new Demo();
        demo.setId(id);
        demo.setP1("p1");
        demo.setP2("p2");
        demo.setP3("p3");
        return demo;
    }

    @Override
    public Map<String, Object> save(Demo demo) {
        log.info("save sql 输出....");
        Map<String, Object> result = new HashMap<>(2);
        result.put("statusCode", 200);
        result.put("message", "success");
        result.put("id", demo.getId());
        return result;
    }


}
